﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Class.aspx.cs" Inherits="admin_Class" StylesheetTheme="admin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        商品分类管理<br />
        <hr />
        <br />
        <table align="center" style="width: 659px; height: 322px" border="1" class="table">
            <tr>
                <td style="width: 132px; height: 5px">
                    输入分类名称：</td>
                <td align="left" colspan="2" style="height: 5px">
                    <asp:TextBox ID="txbCname" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                        ErrorMessage="X"></asp:RequiredFieldValidator>
                    <asp:Button ID="btnSave" runat="server" Text="保 存" OnClick="btnSave_Click" /></td>
            </tr>
            <tr>
                <td colspan="3" rowspan="2" style="height: 193px" align="left" valign="top">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
                        BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1"
                        Width="628px" OnRowDataBound="GridView1_RowDataBound">
                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                        <Columns>
                            <asp:BoundField DataField="id" HeaderText="编号" InsertVisible="False" ReadOnly="True"
                                SortExpression="id" />
                            <asp:BoundField DataField="Category" HeaderText="分类" SortExpression="Category" />
                            <asp:CommandField CausesValidation="False" HeaderText="编辑" ShowEditButton="True" />
                            <asp:CommandField CausesValidation="False" HeaderText="删除" ShowDeleteButton="True" />
                        </Columns>
                        <RowStyle BackColor="White" ForeColor="#003399" />
                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Category] WHERE [id] = @original_id AND [Category] = @original_Category"
                        InsertCommand="INSERT INTO [Category] ([Category]) VALUES (@Category)" OldValuesParameterFormatString="original_{0}"
                        SelectCommand="SELECT [id], [Category] FROM [Category]" UpdateCommand="UPDATE [Category] SET [Category] = @Category WHERE [id] = @original_id AND [Category] = @original_Category">
                        <DeleteParameters>
                            <asp:Parameter Name="original_id" Type="Int32" />
                            <asp:Parameter Name="original_Category" Type="String" />
                        </DeleteParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="Category" Type="String" />
                            <asp:Parameter Name="original_id" Type="Int32" />
                            <asp:Parameter Name="original_Category" Type="String" />
                        </UpdateParameters>
                        <InsertParameters>
                            <asp:Parameter Name="Category" Type="String" />
                        </InsertParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
